/* 
  webpack配置
*/
var path = require('path')

function resolve(pathUrl) {
    return path.resolve(__dirname, pathUrl)
}

module.exports = {
    // 路径别名
    chainWebpack: function(config) {
        config.resolve.alias
            .set('Css', resolve('src/assets/css'))
            .set('Image', resolve('src/assets/image'))
            .set('Components', resolve('src/components'))
            .set('Utils', resolve('src/utils'))
            .set('Store', resolve('src/store'))
            .set('Pages', resolve('src/pages'))
            .set('Homes', resolve('src/pages/home'))
            .set('Filters', resolve('src/filters'))
            .set('Img', resolve('src/assets/img'))
    },
    // 反向代理
    // devServer: {
    //     proxy: {
    //         '/jianke': {
    //             target: 'https://wcgi.jianke.com',
    //             changeOrigin: true,
    //             pathRewrite: {
    //                 '^/jianke': ''
    //             }
    //         }
    //     }
    // }

    // 反向代理
    devServer: {
        proxy: {
            '/jianke': {
                target: 'https://fe-wcgi.jianke.com/v1/',
                changeOrigin: true,
                pathRewrite: {
                    '^/jianke': ''
                }
            }
        }
    }
}